import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne } from 'typeorm';
import { User } from './User';
import { Word } from './Word';

@Entity('user_words')
export class UserWord {
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(() => User, user => user.userWords)
  user: User;

  @ManyToOne(() => Word, word => word.userWords)
  word: Word;

  @Column({ default: 0 })
  familiarity: number;

  @Column({ default: 0 })
  reviewCount: number;

  @Column({ type: 'datetime', nullable: true })
  lastReviewTime: Date;

  @Column({ type: 'datetime', nullable: true })
  nextReviewTime: Date;

  @Column({ default: false })
  isMastered: boolean;

  @CreateDateColumn()
  createdAt: Date;

  @UpdateDateColumn()
  updatedAt: Date;
} 